// ==UserScript==
// @name            Online Player Storer
// @namespace       falcons.marknas.com
// @description     Stores the current set of online players
// @include        	http://orion.pardus.at/statistics.php
// @include        	http://orion.pardus.at/statistics.php?display=onlinelist
// @version		   	0.5.5
// ==/UserScript==

var html = document.getElementsByTagName("table")[6].innerHTML;
var start = 0;
var index = html.indexOf(")'>", start);
var jsonData = "{\"onlinePilots\":[";

while(index != -1){
	start = html.indexOf("</a", index);
	jsonData += "{\"pilot\": \"" + html.substring(index + 3, start) + "\"},";
	index = html.indexOf(")'>", start);
}

if(jsonData != ""){
	jsonData = jsonData.substring(0, jsonData.length - 1) + "]}";
	localStorage.setItem('onlinePilots', jsonData);
}
